local Class = require('lua.lang.Class')

--- @class InstructionPointer : Class
--- @field code number[]
--- @field idx number
local InstructionPointer = Class {}

--- @constructor
--- @param code number[]
--- @param idx number
--- @return InstructionPointer
function InstructionPointer:new(code, idx)
	--- @type InstructionPointer
	local o = {
		code = code,
		idx = idx
	}
	return setmetatable(o, InstructionPointer)
end

--- @return number
function InstructionPointer:get()
	return self.code[self.idx + 1]
end

--- @param value number
--- @return void
function InstructionPointer:set(value)
	self.code[self.idx + 1] = value
end

return InstructionPointer